Extending a source-to-source compiler with XML capabilities
نویسندگان
چکیده
This paper presents an extension that adds XML capabilities to Cetus, a source-to-source compiler developed by Purdue University. In this work, the Cetus Intermediate Representation is converted into an XML DOM tree that, in turn, enables XML capabilities, such as searching speci c code features through XPath expressions. As an example, we write an XPath code to nd private and shared variables for parallel execution in C source code. Loopest is a Java program with embedded XPath expressions. While Cetus needs 2573 lines of internal JAVA code to locate private variables in an input code, Loopest needs a total of only 425 lines of code to determine the same private variables in the equivalent XML representation. Using XPath as search method provides a second advantage over Cetus: extensibility. Changes in Cetus requires a deep knowledge of Java, Cetus internal structure, and its Intermediate Representation. Moreover, changes in Loopest are easier because it only depends on XPath to generate reports. Finally, we present Sirius, an XML DOM tree-to-C converter, that allows to generate the new output C code based on the annotations done in the XML tree.
منابع مشابه
Source Code Files as Structured Documents
A means to add explicit structure to program source code is presented. XML is used to augment source code with syntactic information from the parse tree. More importantly, comments and formatting are preserved and identified for future use by development environments and program comprehension tools. The focus is to construct a document representation in XML instead of a more traditional data re...
متن کاملImplementing Xquery 1.0: The Galax Experience
Galax is a light-weight, portable, open-source implementation of XQuery 1.0. Started in December 2000 as a small prototype designed to test the XQuery static type system, Galax has now become a solid implementation, aiming at full conformance with the family of XQuery 1.0 specifications. Because of its completeness and open architecture, Galax also turns out to be a very convenient platform for...
متن کاملParallel Scanning with Bitstream Addition: An XML Case Study
A parallel scanning method using the concept of bitstream addition is introduced and studied in application to the problem of XML parsing and well-formedness checking. On processors supporting W -bit addition operations, the method can perform up to W finite state transitions per instruction. The method is based on the concept of parallel bitstream technology, in which parallel streams of bits ...
متن کاملJavaML: a markup language for Java source code
The classical plain-text representation of source code is convenient for programmers but requires parsing to uncover the deep structure of the program. While sophisticated software tools parse source code to gain access to the program’s structure, many lightweight programming aids such as grep rely instead on only the lexical structure of source code. I describe a new XML application that provi...
متن کاملSyntax Sensitive and Language Independent Detection of Code Clones
This paper proposes a new technique to detect code clones from the lexical and syntactic point of view, which is based on PALEX source code representation. The PALEX code contains the recorded parsing actions and also lexical formatting information including white spaces and comments. We can record a list of parsing actions (shift, reduce, and reading a token) during a compiling process after a...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
دوره شماره
صفحات -
تاریخ انتشار 2010